package com.mindata.blockchain.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 共识算法
 * User: jasperxgwang
 * Date: 2018-7-31 14:11
 */
public enum ConsensusType {

    /**
     * 拜占庭共识
     */
    PBFT("PBFT"),
    /**
     * Raft 共识
     */
    RAFT("RAFT");

    private String value;

    ConsensusType(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    private static final Map<String, ConsensusType> ENUMMAP = new HashMap();

    static {
        for (ConsensusType consensusType : ConsensusType.values()) {
            ENUMMAP.put(consensusType.getValue(), consensusType);
        }
    }

    public static ConsensusType fromValue(String key) {
        return ENUMMAP.get(key);
    }

}
